package com.ayf.payment.game.api.service.platform.impl;

import com.ayf.payment.game.api.entity.platform.NetQq;
import com.ayf.payment.game.api.mapper.platform.NetQqMapper;
import com.ayf.payment.game.api.service.platform.NetQqService;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import javax.annotation.Resource;
import java.util.List;

@Service
public class NetQqServiceImpl implements NetQqService {

    @Resource
    private NetQqMapper netQqMapper;

    @Override
    public List<NetQq> list() {
        return netQqMapper.selectAll();
    }

    @Override
    public boolean deleteById(Integer id) {
        return netQqMapper.deleteByPrimaryKey(id) > 0;
    }

    @Override
    public boolean add(NetQq netQq) {
        return netQqMapper.insertSelective(netQq) > 0;
    }

    @Override
    public void insertList(List<NetQq> netQqDTOList) {
        netQqMapper.truncateTable();
        if (!CollectionUtils.isEmpty(netQqDTOList)) {
            netQqDTOList.forEach(item -> {
                netQqMapper.insertSelective(item);
            });
        }
    }

}
